package paytreasure.vo;

import java.util.Calendar;
import java.util.Date;

import paytreasure.util.ConstantUtil;


/**
 * 账户详情表
 * @author xhh
 * @date 2017年7月12日 
 *
 */

public class ResilrAccountdetail {
	//billId,icon,money,description,parValue,createDate
	private String billId;			//id
	
    private String icon;           //图标
    
    private String money;          //金额
    
    private String billDescription;    //商品说明
    
    private String parValue;         //面值
    
    private String date;
    private String time;
    private Date createDate;       //创建日期
    
    private String createYearM;       //创建年月
    
    private String createHourM;       //创建年月
    
	public String getBillId() {
		return billId;
	}

	public void setBillId(String billId) {
		this.billId = billId;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}


	public String getMoney() {
		return money;
	}

	public void setMoney(String money) {
		this.money = money;
	}

	public String getBillDescription() {
		return billDescription;
	}

	public void setBillDescription(String billDescription) {
		this.billDescription = billDescription;
	}

	public String getParValue() {
		return parValue;
	}

	public void setParValue(String parValue) {
		this.parValue = parValue;
	}
	
	public Date getCreateDate() {
		return createDate;
	}

//	public void setCreateDate(Date createDate) {
//		this.createDate = createDate;
//	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getCreateYearM() {
		return createYearM;
	}

	public void setCreateYearM(String createYearM) {
		this.createYearM = createYearM;
	}
	

	public String getCreateHourM() {
		return createHourM;
	}

	public void setCreateHourM(String createHourM) {
		this.createHourM = createHourM;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
		
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(createDate);
//        int WeekOfYear = calendar.get(Calendar.DAY_OF_WEEK)-1;
        int hour=calendar.get(Calendar.HOUR_OF_DAY);//小时
        int minute=calendar.get(Calendar.MINUTE);//分
        long time1 = calendar.getTimeInMillis();
		int day1 = calendar.get(Calendar.DAY_OF_YEAR);

		Calendar calendarNow = Calendar.getInstance();
		calendarNow.setTime(new Date());
		int day2 = calendarNow.get(Calendar.DAY_OF_YEAR);

//        long time2 = calendarNow.getTimeInMillis();
//        long between_days=(time2-time1)/(1000*3600*24);
        
        if( (day2-day1) == 0 && calendar.get(Calendar.YEAR) == calendarNow.get(Calendar.YEAR)) {
        	this.date = ConstantUtil.days[0];
        }else if((day2-day1) == 1 && calendar.get(Calendar.YEAR) == calendarNow.get(Calendar.YEAR)) {
        	this.date = ConstantUtil.days[1];
        }else {
//        	this.date = ConstantUtil.week[WeekOfYear];
			int month = calendar.get(Calendar.MONTH)+1;
			int day = calendar.get(Calendar.DAY_OF_MONTH);
			String resultMonth = String.valueOf(month);
			String resultDay = String.valueOf(day);
			if(month < 10) resultMonth = "0" + month;
			if(day <10) resultDay = "0" + day;
			this.date = resultMonth + "-" + resultDay;
		}
		this.time = hour + ":" + minute;
	}
}
